/**********************************************************************
 * Game Entity class
 * by Marc-Henri Vuillaume
 **********************************************************************
 * Free Based on J. S. Harbour Book "Beginning Java 
 * Game Programming"
 **********************************************************************
 * * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 **********************************************************************/
package mhv.fr.sprite;

/** The GameEntity class define a basic entity for game elements.<br>
 * This class contains only position, velocity and status informations.
 * @version Version 1.0
 * @author Marc-Henri Vuillaume
 */
public class GameEntity {

    /**The status of this GameEntity */
    private boolean alive;
    /**The X coordinate of this GameEntity */
    private double x;
    /**The Y coordinate of this GameEntity */
    private double y;
    /**The Next X coordinate of this GameEntity */
    private double nextX;
    /**The Next Y coordinate of this GameEntity */
    private double nextY;
    /**The X velocity of this GameEntity */
    private double velX;
    /**The Y velocity of this GameEntity */
    private double velY;
    /**The Rotation velocity of this GameEntity */
    private double velRotation;
    /**The Rotation angle of this GameEntity */
    private double rotation;
    /**The behaviour status of this GameEntity */
    private int status;
    /**The type of this GameEntity */
    private int type;
    

    /**
     * Getter method
     * @return boolean
     */
    public boolean isAlive() {
        return alive;
    }

    /**
     * Setter method 
     * @param alive boolean
     */
    public void setAlive(boolean alive) {
        this.alive = alive;
    }

    /**
     * Getter method
     * @return double
     */
    public double getX() {
        return x;
    }

    /**
     * Setter method 
     * @param x double
     */
    public void setX(double x) {
        this.x = x;
    }

    public double getNextX() {
        return nextX;
    }

    public void setNextX(double nextX) {
        this.nextX = nextX;
    }

    public double getNextY() {
        return nextY;
    }

    public void setNextY(double nextY) {
        this.nextY = nextY;
    }


    /**
     * Increase X coordinate 
     * @param x double
     */
    public void incX(double x) {
        this.x += x;
    }

    /**
     * Getter method
     * @return y double
     */
    public double getY() {
        return y;
    }
    
    /**
     * Setter method 
     * @param y boolean
     */
    public void setY(double y) {
        this.y = y;
    }

    /**
     * Increase Y coordinate 
     * @param y double
     */
    public void incY(double y) {
        this.y += y;
    }

    /**
     * Getter method
     * @return int
     */
    public int getStatus() {
        return status;
    }

    /**
     * Setter method 
     * @param status int
     */
    public void setStatus(int status) {
        this.status = status;
    }

    /**
     * Getter method
     * @return entity type
     */
    public int getType() {
        return type;
    }

    /**
     * Setter method
     * @param type
     */
    public void setType(int type) {
        this.type = type;
    }

    
    
    /**
     * Getter method
     * @return double
     */
    public double getRotation() {
        return rotation;
    }

    /**
     * Setter method 
     * @param rotation double
     */
    public void setRotation(double rotation) {
        this.rotation = rotation;
    }

    /**
     * Getter method
     * @return double
     */
    public double getVelX() {
        return velX;
    }

    /**
     * Setter method 
     * @param velX double
     */
    public void setVelX(double velX) {
        this.velX = velX;
    }

    /**
     * Getter method
     * @return double
     */
    public double getVelY() {
        return velY;
    }

    /**
     * Setter method 
     * @param velY double
     */
    public void setVelY(double velY) {
        this.velY = velY;
    }

    /**
     * Increase X velocity 
     * @param x double
     */
    public void incVelX(double x) {
        this.velX += x;
    }

    /**
     * Increase Y velocity 
     * @param y double
     */
    public void incVelY(double y) {
        this.velY += y;
    }

    /**
     * Increase rotation 
     * @param rotation double
     */
    public void incRotation(double rotation) {
        this.rotation += rotation;
        rotation = rotation % 360;
    }

    /**
     * Getter method
     * @return double
     */
    public double getVelRotation() {
        return velRotation;
    }

    /**
     * Setter method 
     * @param velRotation double
     */
    public void setVelRotation(double velRotation) {
        this.velRotation = velRotation;
    }

    /**
     * Increase rotation velocity 
     * @param velRotation double
     */
    public void incVelRotation(double velRotation) {
        this.velRotation += velRotation;
    }

    /**
     * Update the rotation by adding velocity 
     */
    public void updateRotation() {
        rotation += velRotation;
        rotation = rotation % 360;
    }

    /**
     * Update the coordinate by adding velocity 
     */
    public void updateMove() {
        x = x + velX;
        y = y + velY;
    }

    /**
     * Construct and initilize GameEntity with coordinate (0,0), velocity (0,0), rotation (0), status (0) and alive (true). 
     */
    public GameEntity() {
        alive = false;
        status = 0;
        x = 0;
        y = 0;
        velX = 0;
        velY = 0;
        rotation = 0;
    }
}
